package com.x.crm.http.response.login;

import com.x.crm.DocDesc;
import com.x.security.model.SecurityAccount;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class CrmAccount implements Serializable{
    @DocDesc("账号ID")
    private String accountId;
    @DocDesc("账号名称")
    private String accountName;
    @DocDesc("账号密码")
    private String accountPassword;
    @DocDesc("账号备注")
    private String accountRemark;
    @DocDesc("账号角色列表")
    private List<CrmRole> roleList = new ArrayList<CrmRole>();
    @DocDesc("账号shopId")
    private String shopId;
    @DocDesc("账号拥有的资源列表")
    private List<CrmResource> resourceList = new ArrayList<CrmResource>();
    /*@DocDesc("账号拥有的资源url列表")
    private List<String> resourceUrlList = new ArrayList<String>();
    @DocDesc("账号自定义属性，以键值对的方式存储")
    private Map<String, String> accountPropertyMap = new HashMap<String, String>();*/
    @DocDesc("所属应用的信息")
    private CrmApplication application;
    @DocDesc("是否主管，true-是，false-否")
    private Boolean isCharge;
    public CrmAccount(SecurityAccount account) {
        this.accountId = account.getAccountId();
        this.accountName= account.getAccountName();
//        this.accountPassword = account.getAccountPassword();
        this.accountRemark = account.getAccountRemark();
        this.shopId = account.getAccountPropertyMap().get("shopId");
        this.roleList = ConvertUtil.convertRoleList(account.getRoleList());
        this.resourceList = ConvertUtil.convertResourceList(account.getResourceList());
//        this.resourceUrlList = account.getResourceUrlList();
//        this.accountPropertyMap = account.getAccountPropertyMap();
        this.application = new CrmApplication(account.getApplication());
    }

    public String getAccountId() {
        return accountId;
    }

    public void setAccountId(String accountId) {
        this.accountId = accountId;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getAccountPassword() {
        return accountPassword;
    }

    public void setAccountPassword(String accountPassword) {
        this.accountPassword = accountPassword;
    }

    public String getAccountRemark() {
        return accountRemark;
    }

    public void setAccountRemark(String accountRemark) {
        this.accountRemark = accountRemark;
    }

    public List<CrmRole> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<CrmRole> roleList) {
        this.roleList = roleList;
    }

    public String getShopId() {
        return shopId;
    }

    public void setShopId(String shopId) {
        this.shopId = shopId;
    }

    public List<CrmResource> getResourceList() {
        return resourceList;
    }

    public void setResourceList(List<CrmResource> resourceList) {
        this.resourceList = resourceList;
    }

    /*public List<String> getResourceUrlList() {
        return resourceUrlList;
    }

    public void setResourceUrlList(List<String> resourceUrlList) {
        this.resourceUrlList = resourceUrlList;
    }

    public Map<String, String> getAccountPropertyMap() {
        return accountPropertyMap;
    }

    public void setAccountPropertyMap(Map<String, String> accountPropertyMap) {
        this.accountPropertyMap = accountPropertyMap;
    }*/

    public CrmApplication getApplication() {
        return application;
    }

    public void setApplication(CrmApplication application) {
        this.application = application;
    }

    public Boolean getIsCharge() {
        return isCharge;
    }

    public void setIsCharge(Boolean charge) {
        isCharge = charge;
    }
}
